
// === uuMeta.style.selectable ===
// depend: uuMeta, uuMeta.style
/*
uuMeta.style.selectable(node)
uuMeta.style.unselectable(node)
 */
(function uuMetaStyleSelectableScope() {
var _mm = uuMeta;

// inner -
function selectableImpl(node,  // @param Node:
                        sel) { // @param Boolean(= true): true is selectable
  var ua = _mm.ua;

  if (ua.ie || ua.opera) {
    while (node) {
      node.unselectable = sel ? "" : "on";
      node.onselectstart = sel ? "" : "return false";
      node = node.parentNode;
    }
  } else if (ua.gecko) {
    node.style["-moz-user-select"] = sel ? "" : "none";
  } else if (ua.webkit) {
    node.style["-webkit-user-select"] = sel ? "" : "none";
  }
}

// uuMeta.style.selectable
function selectable(node) { // @param Node:
  selectableImpl(node, 1);
}

// uuMeta.style.unselectable
function unselectable(node) { // @param Node:
  selectableImpl(node, 0);
}

// --- initialize ---

// --- export ---
_mm.style.selectable   = selectable;
_mm.style.unselectable = unselectable;

})(); // uuMeta.style.selectable scope

